#include <iostream>
using namespace std;

const int kMaxN = 2e5 + 10;

int a[kMaxN], b[kMaxN];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int T;
  for (cin >> T; T; T--) {
    int n;

    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (int i = 0; i <= n; i++) {
      cin >> b[i];
    }

    int dt = 1e9;
    long long ans = 1;

    for (int i = 0; i < n; i++) {
      ans += abs(a[i] - b[i]);
      if ((long long)(a[i] - b[n]) * (b[i] - b[n]) <= 0) {
        dt = 0;
      } else {
        dt = min(dt, min(abs(a[i] - b[n]), abs(b[i] - b[n])));
      }
    }
    cout << ans + dt << "\n";
  }
  return 0;
}